<script lang="ts">
import { ref } from 'vue'
import router from "../router/index.js"
import {instance} from '../req/request.js'
import axios from "axios";
import { ElMessage} from 'element-plus'


export  default {
  data(){
    return{
      user:{
        username:null,
        password:null
      }
    }
  },methods:{
    path(){
      router.push("/forgot")
    },
    zc(){
      router.push("/register")
    },
    dl(message?: any){
      axios({
        method:"post",
        url:'/api/login/login',
        headers: { 'Content-Type': 'application/json' },
        data:this.user
      }).then(res=>{
        // router.push("/home")
        location.href = "#/home"
        alert('登陆成功')
      }).catch(err=>{
        console.log(err)
        ElMessage.error(err.response.data.error)
      })
    }
  }
}
</script>

<template>
  <div style="display: flex; justify-content: center; align-items: center; height: 100vh;">
    <div style="border:solid #409eff; width: 400px; height: 550px; display: flex; flex-direction: column; justify-content: center; align-items: center;">
      <div style="width: 200px; height: 50px; display: flex; align-items: center;">
        <svg t="1713319734410" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="967" width="16" height="16"><path d="M102.4 409.6a409.6 409.6 0 0 0 409.6 409.6c2.1504 0 4.3008-0.1536 6.4-0.4096 2.048 0.256 4.2496 0.4096 6.4 0.4096H768a153.6 153.6 0 0 1 153.6 153.6 51.2 51.2 0 1 0 102.4 0 256 256 0 0 0-256-256h-243.2a51.712 51.712 0 0 0-6.4 0.4096A51.712 51.712 0 0 0 512 716.8a307.2 307.2 0 1 1 307.2-307.2 299.3664 299.3664 0 0 1-58.624 180.5824 51.2 51.2 0 0 0 82.7904 60.2624A399.2576 399.2576 0 0 0 921.6 409.6 409.6 409.6 0 1 0 102.4 409.6z m527.872 129.4336a153.6 153.6 0 0 1-217.2928-2.2528 51.2 51.2 0 0 1 73.216-71.68 51.2 51.2 0 0 0 72.3968 0.768 51.2 51.2 0 0 1 71.68 73.216zM0 921.6v51.2a51.2 51.2 0 1 0 102.4 0v-51.2a102.4 102.4 0 0 1 102.4-102.4 51.2 51.2 0 1 0 0-102.4 204.8 204.8 0 0 0-204.8 204.8z" fill="#000000" p-id="968"></path></svg>
        <el-input align="right" v-model="user.username" placeholder="请输入账号" id = "username"/>
      </div>
      <div style="width: 200px; height: 50px; display: flex; align-items: center;">
        <svg t="1713321553763" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="3930" width="16" height="16"><path d="M853.932164 349.716959l-91.221832 0c0-146.51384-111.981287-258.495127-254.702534-258.495127-142.920858 0-254.702534 111.981287-254.702534 258.495127L161.883821 349.716959C161.883821 173.860429 316.980897 0 507.808187 0 698.635478 0 853.932164 173.860429 853.932164 349.716959L853.932164 349.716959zM969.706043 499.624172c0-50.301754-40.920078-91.221832-91.221832-91.221832L147.511891 408.402339c-50.301754 0-91.221832 40.920078-91.221832 91.221832l0 433.153996c0 50.301754 40.920078 91.221832 91.221832 91.221832l730.77271 0c50.301754 0 91.221832-40.920078 91.221832-91.221832L969.506433 499.624172 969.706043 499.624172zM585.25692 838.362573c0 37.726316-30.540351 68.466277-68.466277 68.466277l-9.780897 0c-37.726316 0-68.466277-30.540351-68.466277-68.466277l0-185.637427c0-37.726316 30.540351-68.466277 68.466277-68.466277l9.780897 0c37.726316 0 68.466277 30.540351 68.466277 68.466277L585.25692 838.362573 585.25692 838.362573zM585.25692 838.362573" fill="#272636" p-id="3931"></path></svg>
        <el-input v-model="user.password" placeholder="请输入密码" show-password id="password"/>
      </div>
      <div>
        
      </div>
      <div>
        <el-button type="primary" @click="dl">登录</el-button>
      </div>
      <div style=" display: flex; align-items: center; justify-content: flex-end;">
        <svg t="1713322051319" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4994" width="16" height="16"><path d="M503.381333 753.664c-6.741333 0-12.586667 2.346667-17.578666 6.954667-4.906667 4.266667-7.338667 9.728-7.338667 16.298666 0 6.485333 2.432 11.946667 7.338667 16.298667 5.077333 4.522667 10.965333 6.784 17.578666 6.784 6.485333 0 12.288-2.261333 17.408-6.784 4.864-4.352 7.296-9.813333 7.296-16.298667 0-6.570667-2.432-12.032-7.296-16.298666-4.992-4.608-10.794667-6.954667-17.408-6.954667z m56.661334-110.037333c4.608-5.845333 8.405333-12.202667 11.434666-19.157334 2.986667-6.954667 4.522667-14.848 4.522667-23.765333 0-9.344-1.792-17.578667-5.418667-24.618667-3.584-7.082667-8.533333-12.970667-14.762666-17.706666-6.314667-4.736-13.610667-8.32-21.973334-10.752-8.362667-2.432-17.237333-3.626667-26.624-3.626667-20.437333 0-40.192 5.546667-59.221333 16.64v40.064c15.658667-15.36 32.170667-23.082667 49.450667-23.082667 5.333333 0 10.368 0.64 15.061333 1.92 4.693333 1.28 8.874667 3.2 12.544 5.802667s6.528 5.845333 8.618667 9.728c2.090667 3.882667 3.114667 8.405333 3.114666 13.610667 0 5.802667-1.408 11.093333-4.266666 15.957333-2.816 4.864-6.357333 9.472-10.624 13.866667-4.224 4.394667-8.789333 8.917333-13.738667 13.568-4.949333 4.608-9.514667 9.386667-13.738667 14.378666-4.266667 4.949333-7.808 10.325333-10.624 16.042667-2.858667 5.717333-4.266667 12.117333-4.266666 19.157333 0 4.522667 0.384 9.088 1.194666 13.696 0.810667 4.650667 1.749333 8.405333 2.816 11.264h36.736c-1.28-2.730667-2.56-6.144-3.84-10.197333-1.28-4.053333-1.92-8.576-1.92-13.525333 0-5.930667 1.493333-11.306667 4.522667-16.170667 3.029333-4.864 6.826667-9.514667 11.434667-14.037333 4.565333-4.48 9.514667-9.002667 14.762666-13.525334 5.290667-4.522667 10.24-9.685333 14.805334-15.530666zM800.810667 832c0 29.44-23.552 53.333333-52.48 53.333333H275.669333c-28.928 0-52.522667-23.893333-52.522666-53.333333v-319.957333c0-29.44 23.594667-53.376 52.522666-53.376h472.661334c28.928 0 52.48 23.936 52.48 53.376V832zM354.432 303.573333c0-90.922667 61.226667-164.906667 156.586667-164.906666 94.421333 0 158.506667 72.448 158.506666 164.906666v101.802667H354.432V303.573333z m393.898667 101.802667h-26.282667V303.573333c0-122.410667-87.168-218.24-211.029333-218.24-124.330667 0-209.066667 97.877333-209.066667 218.24v101.802667h-26.282667c-57.898667 0-105.002667 47.829333-105.002666 106.666667V832c0 58.837333 47.104 106.666667 105.002666 106.666667h472.661334c57.898667 0 105.002667-47.829333 105.002666-106.666667v-319.957333c0-58.837333-47.104-106.666667-105.002666-106.666667z" fill="#333333" p-id="4995"></path></svg>
        <el-button @click="path">忘记密码</el-button>
      </div>
      <div style=" display: flex; align-items: center; justify-content: flex-end;">
        <svg t="1713425077764" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="3406" width="16" height="16"><path d="M752.779277 614.774544c22.772498 0 41.198849-18.466262 41.198849-41.195779 0-13.119284-6.122673-24.787464-15.663319-32.329517l0.212856-0.25993c-31.702207-24.541861-66.94621-44.657755-105.004413-59.222002 48.439015-41.559066 79.256028-103.114295 79.256028-171.951647 0-125.12133-101.463639-226.585993-226.585993-226.585993-125.123377 0-226.587016 101.464663-226.587016 226.585993 0 68.837352 30.818036 130.392581 79.257051 171.951647-154.571154 59.301823-264.565398 208.763415-264.646242 384.297793l0 0.079821c0.080844 22.689607 18.507195 41.118004 41.198849 41.118004 22.770451 0 41.116981-18.428398 41.196802-41.118004 0-181.727662 147.894851-329.58158 329.58158-329.58158 74.497474 0 143.081036 25.128238 198.294595 66.945187C731.868244 610.484682 741.817205 614.774544 752.779277 614.774544zM526.193284 454.008059c-79.498561 0-144.190342-64.692805-144.190342-144.192389 0-79.498561 64.693828-144.191366 144.190342-144.191366 79.498561 0 144.191366 64.692805 144.191366 144.191366S605.691845 454.008059 526.193284 454.008059zM909.926191 752.851423 848.129453 752.851423l0-61.798785c0.001023-17.057115-13.839719-30.897857-30.897857-30.897857-17.099073 0-30.897857 13.840742-30.897857 30.897857l0 61.798785-61.796738 0c-17.097026 0-30.896834 13.838695-30.896834 30.897857 0 17.057115 13.799808 30.897857 30.896834 30.897857l61.796738 0 0 61.796738c0 17.059162 13.798785 30.895811 30.897857 30.895811 17.058139 0 30.897857-13.836649 30.897857-30.895811l0-61.796738 61.796738 0c17.058139 0 30.897857-13.840742 30.897857-30.897857C940.824049 766.691142 926.985353 752.851423 909.926191 752.851423z" fill="#272636" p-id="3407"></path></svg>
        <el-button @click="zc">注册账号</el-button>
      </div>
    </div>
  </div>
</template>